﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Ricciolo.Controls;
using System.Windows.Controls;
using System.Windows.Data;


namespace OpenExpressApp.Module.WPF.Editors.TreeColumn
{
    public class BooleanTreeColumn : TreeColumn
    {
        public BooleanTreeColumn(BusinessObjectPropertyInfo info, IListObjectView view)
            : base(info, view) { }

        public override FrameworkElement GenerateEditingFrameworkElement()
        {
            CheckBox cb = new CheckBox();
            Binding b = new Binding(PropertyInfo.Name);
            cb.SetBinding(CheckBox.IsCheckedProperty, b);
            cb.HorizontalAlignment = HorizontalAlignment.Center;
            cb.VerticalAlignment = VerticalAlignment.Center;
            return cb;
        }

        protected override FrameworkElementFactory GenerateElementFactoryInBorder()
        {
            FrameworkElementFactory cb = new FrameworkElementFactory(typeof(CheckBox));
            Binding b = new Binding(PropertyInfo.Name);
            cb.SetBinding(CheckBox.IsCheckedProperty, b);
            cb.SetValue(Border.HorizontalAlignmentProperty, HorizontalAlignment.Center);
            cb.SetValue(Border.VerticalAlignmentProperty, VerticalAlignment.Center);
            return cb;
        }
        protected override FrameworkElement GenerateElementInBorder()
        {
            return this.GenerateEditingFrameworkElement();
        }
    }
}
